_init: function() {
this.isLoading = false;
+ this.isDummy = true;
+ },
+
+ destroy: function() {
},
requestRange: function(begin, end) {
_init: function() {
this._resetCache();
this.isLoading = false;
+ this.isDummy = false;
this._initialized = false;
this._dbusProxy = new CalendarServer();
}));
},
+ destroy: function() {
+ this._dbusProxy.run_dispose();
+ },
+
_resetCache: function() {
this._events = [];
this._lastRequestBegin = null;
// @eventSource: is an object implementing the EventSource API, e.g. the
// requestRange(), getEvents(), hasEvents() methods and the ::changed signal.
setEventSource: function(eventSource) {
- if (this._eventSource) {
- this._eventSource.disconnect(this._eventSourceChangedId);
- this._eventSource = null;
- }
-
this._eventSource = eventSource;
-
- if (this._eventSource) {
- this._eventSourceChangedId = this._eventSource.connect('changed', Lang.bind(this, function() {
- this._update(false);
- }));
- this._update(true);
- }
+ this._eventSource.connect('changed', Lang.bind(this, function() {
+ this._update(false);
+ }));
+ this._update(true);
},
// Sets the calendar to show a specific date
let button = new St.Button({ label: iter.getDate().toString() });
let rtl = button.get_text_direction() == Clutter.TextDirection.RTL;
- if (!this._eventSource)
+ if (this._eventSource.isDummy)
button.reactive = false;
let iterStr = iter.toUTCString();
this.setDate(newlySelectedDate, false);
}));
- let hasEvents = this._eventSource && this._eventSource.hasEvents(iter);
+ let hasEvents = this._eventSource.hasEvents(iter);
let styleClass = 'calendar-day-base calendar-day';
if (_isWorkDay(iter))
}
// Signal to the event source that we are interested in events
// only from this date range
- if (this._eventSource)
- this._eventSource.requestRange(beginDate, iter, forceReload);
+ this._eventSource.requestRange(beginDate, iter, forceReload);
}
});
},
setEventSource: function(eventSource) {
- if (this._eventSource) {
- this._eventSource.disconnect(this._eventSourceChangedId);
- this._eventSource = null;
- }
-
this._eventSource = eventSource;
-
- if (this._eventSource) {
- this._eventSourceChangedId = this._eventSource.connect('changed', Lang.bind(this, this._update));
- }
+ this._eventSource.connect('changed', Lang.bind(this, this._update));
},
_addEvent: function(dayNameBox, timeBox, eventTitleBox, includeDayName, day, time, desc) {
},
_addPeriod: function(header, begin, end, includeDayName, showNothingScheduled) {
- if (!this._eventSource)
- return;
-
let events = this._eventSource.getEvents(begin, end);
let clockFormat = this._desktopSettings.get_string(CLOCK_FORMAT_KEY);;